package com.maomao.SMSUtil;


import com.alibaba.fastjson.JSONObject;

import java.util.HashMap;
import java.util.Map;

public class SendMessageUtil {
    public static void main(String[] args) {
        String mobileNumber = "18720971965";
       System.out.println(sendMessage(mobileNumber));
    }
    public static String sendMessage(String mobileNumbers) {
        String SMSUserName = "hzjbyzm";
        String SMSPassword = EncodedUtil.getMD5Str("hzjbyzm1015");
        int userPassword = EncodedUtil.getRandom();
        String SMSMessage = EncodedUtil.base64Encode("您的验证码："+userPassword);
        String url = "http://www.yescloudtree.cn:28009";
        Map<String, Object> map = new HashMap<>();
        map.put("Action","sendsms");
        map.put("UserName",SMSUserName);
        map.put("Password",SMSPassword.toUpperCase());
        map.put("Mobile",mobileNumbers);
        map.put("Message",SMSMessage);
        JSONObject param = (JSONObject) JSONObject.toJSON(map);
        String result = HttpClientUtil.doPost(url,param);
        return result;
    }
}
